<!Doctype html>
<html>
<head>
	<meta charset="utf-8" />
	<title></title>
	<style>
	</style>
</head>
<body>
	<input type="button" value="按钮" id="btn">
	<input type="button" value="按钮" id="btn1">
	<script>
		var btn = document.getElementById('btn');
		var btn1 = document.getElementById('btn1');
		var a = 10;
		var b = 20;
		var foo = function () {
			var c = a;
			alert( c);
		}
		function foo1(){
			var c = a;
			var a =30;
			alert(c);
		}
		btn.onclick = foo;
		btn1.onclick = foo1;
	</script>
<!-- 	<script>

		var a = '123.56789a';
		var o = Number(a);  //将数据转换成数值型，数值返回数值对象,非数值型返回NaN
		var c = parseInt(a);  //字符串转换成整数
		var n = parseFloat(a);  //字符串转换成浮点数
		var b = n.toFixed(2);  //只可对数值型应用该（方法）函数,返回字符串
		var i = n.valueOf();
		console.log(o);
		console.log(typeof o);
		console.log(c);
		console.log(typeof c);
		console.log(n);
		console.log(typeof n);
		console.log(b);
		console.log(typeof b);		
		console.log(i);
		console.log(typeof i);
	</script> -->
</body>
</html>





